<?php
 include_once('../../src/classes/class.mysql.php');
    
    $comtec_id_user = $_GET['id'];

    $db = new MySQL();
    
    $texto = "SELECT name,lastname1,lastname2,phone,email,position,access_level
              FROM users
              WHERE comtec_id_user=".$comtec_id_user;
    
    $row = $db->fetch_array($db->query($texto));  
   
     $name=$row['name'];
     $lastname1=$row['lastname1'];
     $lastname2=$row['lastname2'];
     $phone=$row['phone'];
     $email=$row['email'];
     $position=$row['position'];
     $access_level=$row['access_level'];
    
?>
<fieldset class="curved">
          <legend>Editar</legend>
           <table style="margin: 10px auto; border-spacing: 10px;">
                  <tr>
                      <td width="200">Tipo de usuario: </td>
                      <td>
                          <select id="access_level" style="width:257px;" >
                           <?php if($access_level==1){?>
                           <option value="1" selected>Gerente</option>
                           <?php }else { ?>
                           <option value="1">Gerente</option>
                           <?php }?>
                           <?php if($access_level==2){?>
                           <option value="2" selected>Administrativo-1</option>
                           <?php }else { ?>
                           <option value="2">Administrativo-1</option>
                           <?php }?>
                           <?php if($access_level==3){?>
                           <option value="3">Administrativo-2</option>
                           <?php }else { ?>
                           <option value="3">Administrativo-2</option>
                           <?php }?>
                           <?php if($access_level==4){?>
                           <option value="4" selected>T&eacute;cnico</option>
                           <?php }else { ?>
                           <option value="4">T&eacute;cnico</option>
                           <? }?>
                           <? if($access_level==5){?>
                           <option value="5" selected>Cliente</option>
                           <? }else { ?>
                           <option value="5">Cliente</option>
                           <? }?>
                          </select> 
                         </td>    
                  
                         <td width="200">Cargo: </td>
                         <td><input type="text" size="40" maxlength="150" id="position" value="<?=$position;?>" /></td>
                  </tr>
                  <tr>
                         <td width="200">Nombre: </td>
                         <td><input type="text" size="40" maxlength="50" id="name" value="<?=$name;?>" /></td>
                
                         <td width="200">Apellido Paterno: </td>
                         <td><input type="text" size="40" maxlength="50" id="lastname1" value="<?=$lastname1;?>" /></td>
                  </tr>
                  <tr>
                         <td width="200">Apellido Materno: </td>
                         <td><input type="text" size="40" maxlength="50" id="lastname2" value="<?=$lastname2;?>" /></td>
                  
                         <td width="200">Tel&eacute;fono: </td>
                         <td><input type="text" size="40" maxlength="20" id="phone" value="<?=$phone;?>" /></td>
                  </tr>
                  <tr>
                      <td width="200">Correo electr&oacute;nico: </td>
                         <td><input type="text" size="40" maxlength="100" id="email" value="<?=$email;?>"  />
                         </td>
                         
                  </tr>
              
                  <tr>
                    <td>
                        <input type="button" id="edit" value="Editar" onclick="javascript:editUser(<?=$comtec_id_user;?>)" />
                        <input type="button" value="Cancelar" onclick="javascript:loadUsers();" />
                    </td>
                  </tr>
          </table>         
          <div id="result"></div> 
  </fieldset> 
